package com.ycr.springmvc.listener;

import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;

import com.ycr.springmvc.event.AnimalSpeakEvent;

public class AnimalEventListener implements ApplicationListener{

	@Override
	public void onApplicationEvent(ApplicationEvent e) {
		if(e instanceof AnimalSpeakEvent){
			AnimalSpeakEvent a = (AnimalSpeakEvent)e;
			System.out.println("事件监听器" 
					+ this.getClass().getSimpleName()
					+":有一个动物在讲话！它的名字是:"
					+ a.getAnimalName());
		}
	}

}
